import ala from 'ala'

/**
 *  修改值
 * field相关值：状态Status、处理人EmployeeId、类型Type、名称Name、分类ClassId、完成方式CompleteWay、
 * 详细内容Content、优先级Priority、岗位类型RoleType、WorkingHourIn、（对外工时）WorkingHourOut
 * @returns 
 */
export async function update (id, field, value) {
    var para = {
        id: id,
        field: field,
        value: value
    }

    var result = await ala.httpPost('Api/CustomerMatter/Update', para)
    return result
}


/**
 * 删除
 * @param {*} id 
 * @returns 
 */
export async function deleteItem (This, id) {
    return new Promise((resolve) => {
        var result = null
        var para = {
            id: id
        }
        This.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
        }).then(async () => {
            result = await ala.httpGet('Api/CustomerMatter/Delete', para)
            ala.localRemove('support_select_init')
            resolve(result)
        }).catch(() => {
            This.$message({
                type: 'info',
                message: '已取消删除'
            })
            resolve(result)
        })
    })
}


